package com.wc.alorithm_luogu.P5730;

import java.util.HashMap;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/21 13:30
 * @description https://www.luogu.com.cn/problem/P5730
 * 显示屏
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        HashMap<Character, StringBuffer> map = new HashMap<>();

        // 提取
        String everyNum = "XXX...X.XXX.XXX.X.X.XXX.XXX.XXX.XXX.XXX\n" +
                "X.X...X...X...X.X.X.X...X.....X.X.X.X.X\n" +
                "X.X...X.XXX.XXX.XXX.XXX.XXX...X.XXX.XXX\n" +
                "X.X...X.X.....X...X...X.X.X...X.X.X...X\n" +
                "XXX...X.XXX.XXX...X.XXX.XXX...X.XXX.XXX";
        for (int i = 0; i < 10; i++) {
            map.put((char) (i + 48), new StringBuffer());
        }
        String[] split = everyNum.split("\n");

        // 将每一个数字都分配到一行
        for (String s : split) {
            StringBuffer str = map.get('0');
            str.append(s.subSequence(0, 3));
            int left;
            int right;
            for (int j = 1; j < 10; j++) {
                str = map.get((char) (j + 48));
                left = j * 3 + j;
                right = left + 3;
                str.append(s.subSequence(left, right));
            }
        }

        int n = Integer.parseInt(sc.nextLine());
        String originStr = sc.nextLine();

        StringBuffer ans = new StringBuffer();

        // 按照map提取就好
        for (int i = 0; i < 5; i++) {
            ans.append(map.get(originStr.charAt(0)).subSequence(i * 3, i * 3 + 3));
            for (int j = 1; j < n; j++) {
                ans.append('.');
                ans.append(map.get(originStr.charAt(j)).subSequence(i * 3, i * 3 + 3));
            }
            ans.append("\n");
        }
        System.out.println(ans);
    }
}
